package com.jy.event.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by lihu on 2017/10/21.
 */

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
public class WebRecharge {

    @Id
    @Column(length = 50)
    private String id;


    private String storeId;

    /**
     * 充值金额(单位分)
     */
    private int amount = 120000;

    /**
     * 充值方式
     */
    @Enumerated(EnumType.STRING)
    private PaymentChannel channel;

    /**
     * 充值状态
     */
    @Enumerated(EnumType.STRING)
    private PaymentStatus status = PaymentStatus.NOTSURE;

    /**
     * 同步状态
     */
    private boolean synchro = false;


    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3)")
    private Date addTime;

    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)")
    private Date updateTime;

    public WebRecharge(String id, String storeId, PaymentChannel channel) {
        this.id = id;
        this.storeId = storeId;
        this.channel = channel;
    }
}
